package com.biz.primus.ms.payment.channel.wechat.res;

import com.biz.primus.common.utils.DateUtil;
import java.util.Date;

import static com.biz.primus.ms.payment.channel.wechat.lang.Keys.*;
import static org.apache.commons.lang3.StringUtils.isBlank;

public class TransferResponse extends BaseWechatPayRespVo {

    private static final long serialVersionUID = -8770000914872002696L;

    public TransferResponse(String responseXml) {
        super(responseXml);
    }

    @Override
    public String getAppId() {
        return getProperty(MCH_APPID);
    }

    @Override
    public String getMchId() {
        return getProperty(MCHID);
    }

    public String getPartnerTradeNo() {
        return getProperty(PARTNER_TRADE_NO);
    }

    public String getPaymentNo() {
        return getProperty(PAYMENT_NO);
    }

    public Date getPaymentTime() {
        String paymentTime = getProperty(PAYMENT_TIME);
        return isBlank(paymentTime) ?
                null :
                DateUtil.getTimestamp(paymentTime, PAYMENT_TIME_DATE_FORMATER);
    }

    public Boolean isTransferSuccess() {
        return isProcessSuccess();
    }

}
